Repository navigation
fix: declare optional React type peers for published packages - #10953
Open
Sophran-fbj wants to merge 1 commit into
Open
Sophran-fbj wants to merge 1 commit into
Sophran-fbj wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10940
Summary
In pnpm's global virtual store, the published declarations can resolve
reactto its untyped JavaScript entry even when the application has installed@types/react. This loses contextual typing for callbacks such asButton.onKeyDown.Declare
@types/reactas an optional peer inreact-aria-components,react-aria,react-stately, and@react-types/shared. The*range lets consumers supply their existing React types, while the optional flag keeps JavaScript-only installs working without them. Update the workspace lockfile accordingly.Also exclude optional peers from the workspace constraint that propagates required peers. Otherwise, these declarations cause the constraint to require many dependent workspaces to declare the type peer as a required dependency. Required-peer propagation is unchanged. Manifest key ordering was normalized by the repository formatter.
Prepared with AI assistance (Codex), including implementation, local validation, and this description.
📝 Test Instructions
virtualStoreType: global,addMissingPeerTypes: false,autoInstallPeers: false, TypeScript 5.9.3, React/types 19.3.0. With the released versions listed in the issue, aButtonkeyboard callback has an implicitly-any parameter (TS7006), and an@ts-expect-errorfor an invalid event property is unused (TS2578).@types/reactinstalls the patched tarballs without adding React types and can importButton.yarn lintpasses, including formatting, typechecking, package lint, and constraints.yarn install --immutable --mode=skip-buildpasses. Local constraint smoke checks confirm optional peers are skipped and non-optional peers still propagate.yarn test --maxWorkers=2 --silent: 380 suites passed, 4 failed; 7,909 tests passed, 16 failed, 16 skipped. Failures are in NumberField, NumberParser, LocalesResolver, and codemod CLI tests on this Windows run (including empty locale test data and Windows path differences). Those implementations/tests are unchanged by this PR.yarn test:ssr --silent: 58 suites passed, 2 timed out. Both failed suites pass when rerun with--testTimeout=120000(5 tests).yarn buildcould not run becausemakeis unavailable on this Windows host. Browser/VRT coverage is not applicable to the dependency metadata change; no Chromatic runs were started.Release impact
✅ PR Checklist
The final ownership/understanding checkbox is left for the human author to confirm.
🧢 Your Project
Personal open-source contribution.